home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / QD3DErrors.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  9.9 KB  |  367 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DErrors.h                                             **
  4.  **                                                                             **
  5.  **                                                                             **
  6.  **     Purpose:    Error API and error codes                                 **
  7.  **                                                                             **
  8.  **                                                                             **
  9.  **                                                                             **
  10.  **     Copyright (C) 1992-1997 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                             **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DError_h
  15. #define QD3DError_h
  16.  
  17. #include "QD3D.h"
  18.  
  19. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  20.     #pragma once
  21. #endif  /*  PRAGMA_ONCE  */
  22.  
  23. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  24.  
  25. #if defined(__xlc__) || defined(__XLC121__)
  26.     #pragma options enum=small
  27. #endif
  28.  
  29. #include <Types.h>
  30.  
  31. #if defined(__xlc__) || defined(__XLC121__)
  32.     #pragma options enum=reset
  33.     #pragma options enum=int
  34.     #pragma options align=power
  35. #elif defined(__MWERKS__)
  36.     #pragma enumsalwaysint on
  37.     #pragma options align=native
  38. #elif defined(__MRC__) || defined(__SC__)
  39.     #if __option(pack_enums)
  40.         #define PRAGMA_ENUM_RESET_QD3DERRORS 1
  41.     #endif
  42.     #pragma options(!pack_enums)
  43.     #pragma options align=power
  44. #endif
  45.  
  46. #endif  /* OS_MACINTOSH */
  47.  
  48.  
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif  /*  __cplusplus  */
  52.  
  53.  
  54. /******************************************************************************
  55.  **                                                                             **
  56.  **                            Error Types and Codes                             **
  57.  **                                                                             **
  58.  *****************************************************************************/
  59.  
  60. typedef enum TQ3Error {
  61.     kQ3ErrorNone = 0,        
  62.     /* Fatal Errors */
  63.     kQ3ErrorInternalError            = -28500,
  64.     kQ3ErrorNoRecovery,
  65.     kQ3ErrorLastFatalError,
  66.     /* System Errors */
  67.     kQ3ErrorNotInitialized            = -28490,
  68.     kQ3ErrorAlreadyInitialized,
  69.     kQ3ErrorUnimplemented,
  70.     kQ3ErrorRegistrationFailed,
  71.     /* OS Errors */
  72.     kQ3ErrorUnixError,
  73.     kQ3ErrorMacintoshError,
  74.     kQ3ErrorX11Error,
  75.     /* Memory Errors */
  76.     kQ3ErrorMemoryLeak,
  77.     kQ3ErrorOutOfMemory,
  78.     /* Parameter errors */
  79.     kQ3ErrorNULLParameter,
  80.     kQ3ErrorParameterOutOfRange,
  81.     kQ3ErrorInvalidParameter,            
  82.     kQ3ErrorInvalidData,                
  83.     kQ3ErrorAcceleratorAlreadySet,        
  84.     kQ3ErrorVector3DNotUnitLength,
  85.     kQ3ErrorVector3DZeroLength,
  86.     /* Object Errors */
  87.     kQ3ErrorInvalidObject,
  88.     kQ3ErrorInvalidObjectClass,
  89.     kQ3ErrorInvalidObjectType,
  90.     kQ3ErrorInvalidObjectName,
  91.     kQ3ErrorObjectClassInUse,            
  92.     kQ3ErrorAccessRestricted,
  93.     kQ3ErrorMetaHandlerRequired,
  94.     kQ3ErrorNeedRequiredMethods,
  95.     kQ3ErrorNoSubClassType,
  96.     kQ3ErrorUnknownElementType,
  97.     kQ3ErrorNotSupported,
  98.     /* Extension Errors */
  99.     kQ3ErrorNoExtensionsFolder,
  100.     kQ3ErrorExtensionError,
  101.     kQ3ErrorPrivateExtensionError,
  102.     /* Geometry Errors */
  103.     kQ3ErrorDegenerateGeometry,
  104.     kQ3ErrorGeometryInsufficientNumberOfPoints,
  105.     /* IO Errors */
  106.     kQ3ErrorNoStorageSetForFile,
  107.     kQ3ErrorEndOfFile,
  108.     kQ3ErrorFileCancelled,
  109.     kQ3ErrorInvalidMetafile,
  110.      kQ3ErrorInvalidMetafilePrimitive,
  111.      kQ3ErrorInvalidMetafileLabel,
  112.      kQ3ErrorInvalidMetafileObject,
  113.      kQ3ErrorInvalidMetafileSubObject,
  114.     kQ3ErrorInvalidSubObjectForObject,
  115.     kQ3ErrorUnresolvableReference,
  116.     kQ3ErrorUnknownObject,
  117.     kQ3ErrorStorageInUse,
  118.     kQ3ErrorStorageAlreadyOpen,
  119.     kQ3ErrorStorageNotOpen,
  120.     kQ3ErrorStorageIsOpen,
  121.     kQ3ErrorFileAlreadyOpen,
  122.     kQ3ErrorFileNotOpen,
  123.     kQ3ErrorFileIsOpen,
  124.     kQ3ErrorBeginWriteAlreadyCalled,
  125.     kQ3ErrorBeginWriteNotCalled,
  126.     kQ3ErrorEndWriteNotCalled,
  127.     kQ3ErrorReadStateInactive,
  128.     kQ3ErrorStateUnavailable,
  129.     kQ3ErrorWriteStateInactive,
  130.     kQ3ErrorSizeNotLongAligned,
  131.     kQ3ErrorFileModeRestriction,
  132.     kQ3ErrorInvalidHexString,
  133.     kQ3ErrorWroteMoreThanSize,
  134.     kQ3ErrorWroteLessThanSize,
  135.     kQ3ErrorReadLessThanSize,
  136.     kQ3ErrorReadMoreThanSize,
  137.     kQ3ErrorNoBeginGroup,
  138.     kQ3ErrorSizeMismatch,
  139.     kQ3ErrorStringExceedsMaximumLength,
  140.     kQ3ErrorValueExceedsMaximumSize,
  141.     kQ3ErrorNonUniqueLabel,
  142.     kQ3ErrorEndOfContainer,
  143.     kQ3ErrorUnmatchedEndGroup,
  144.     kQ3ErrorFileVersionExists,
  145.     /* View errors */
  146.     kQ3ErrorViewNotStarted,
  147.     kQ3ErrorViewIsStarted,
  148.     kQ3ErrorRendererNotSet,
  149.     kQ3ErrorRenderingIsActive,
  150.     kQ3ErrorImmediateModeUnderflow,
  151.     kQ3ErrorDisplayNotSet,
  152.     kQ3ErrorCameraNotSet,
  153.     kQ3ErrorDrawContextNotSet,
  154.     kQ3ErrorNonInvertibleMatrix,
  155.     kQ3ErrorRenderingNotStarted,
  156.     kQ3ErrorPickingNotStarted,
  157.     kQ3ErrorBoundsNotStarted,
  158.     kQ3ErrorDataNotAvailable,
  159.     kQ3ErrorNothingToPop,
  160.     /* Renderer Errors */
  161.     kQ3ErrorUnknownStudioType,            
  162.     kQ3ErrorAlreadyRendering,
  163.     kQ3ErrorStartGroupRange,
  164.     kQ3ErrorUnsupportedGeometryType,
  165.     kQ3ErrorInvalidGeometryType,
  166.     kQ3ErrorUnsupportedFunctionality,
  167.     /* Group Errors */
  168.     kQ3ErrorInvalidPositionForGroup,
  169.     kQ3ErrorInvalidObjectForGroup,
  170.     kQ3ErrorInvalidObjectForPosition,
  171.     /* Transform Errors */
  172.     kQ3ErrorScaleOfZero,                
  173.     /* String Errors */
  174.     kQ3ErrorBadStringType,                
  175.     /* Attribute Errors */
  176.     kQ3ErrorAttributeNotContained,        
  177.     kQ3ErrorAttributeInvalidType,        
  178.     /* Camera Errors */
  179.     kQ3ErrorInvalidCameraValues,        
  180.     /* DrawContext Errors */
  181.     kQ3ErrorBadDrawContextType,
  182.     kQ3ErrorBadDrawContextFlag,
  183.     kQ3ErrorBadDrawContext,
  184.     kQ3ErrorUnsupportedPixelDepth,
  185.     /* Controller Errors */
  186.     kQ3ErrorController,
  187.     /* Tracker Errors */
  188.     kQ3ErrorTracker,
  189.     /* Another OS Error */
  190.     kQ3ErrorWin32Error,
  191.     /* Object Errors */
  192.     kQ3ErrorTypeAlreadyExistsAndHasSubclasses,
  193.     kQ3ErrorTypeAlreadyExistsAndOtherClassesDependOnIt,
  194.     kQ3ErrorTypeAlreadyExistsAndHasObjectInstances,
  195.     /*
  196.      * submit loop errors: if you ever get one of these check the previous
  197.      * error posted, it may be kQ3ErrorOutOfMemory.  If so you *may* be able
  198.      * to recover by freeing up some memory and trying again
  199.      */
  200.     kQ3ErrorPickingLoopFailed,
  201.     kQ3ErrorRenderingLoopFailed,
  202.     kQ3ErrorWritingLoopFailed,
  203.     kQ3ErrorBoundingLoopFailed
  204. } TQ3Error;
  205.  
  206. typedef enum TQ3Warning {
  207.     kQ3WarningNone = 0,
  208.     /* General System */
  209.     kQ3WarningInternalException = -28300,    
  210.     /* Object Warnings */
  211.     kQ3WarningNoObjectSupportForDuplicateMethod,
  212.     kQ3WarningNoObjectSupportForDrawMethod,
  213.     kQ3WarningNoObjectSupportForWriteMethod,
  214.     kQ3WarningNoObjectSupportForReadMethod,
  215.     kQ3WarningUnknownElementType,
  216.     kQ3WarningTypeAndMethodAlreadyDefined,
  217.     kQ3WarningTypeIsOutOfRange,
  218.     kQ3WarningTypeHasNotBeenRegistered,
  219.     /* Parameter Warnings */
  220.     kQ3WarningVector3DNotUnitLength,
  221.     /* IO Warnings */
  222.     kQ3WarningInvalidSubObjectForObject,
  223.     kQ3WarningInvalidHexString,
  224.     kQ3WarningUnknownObject,
  225.     kQ3WarningInvalidMetafileObject,
  226.     kQ3WarningUnmatchedBeginGroup,
  227.     kQ3WarningUnmatchedEndGroup,
  228.     kQ3WarningInvalidTableOfContents,
  229.     kQ3WarningUnresolvableReference,
  230.     kQ3WarningNoAttachMethod,
  231.     kQ3WarningInconsistentData,
  232.     kQ3WarningReadLessThanSize,
  233.     kQ3WarningFilePointerResolutionFailed,
  234.     kQ3WarningFilePointerRedefined,
  235.     kQ3WarningStringExceedsMaximumLength,
  236.     /* Memory Warnings */
  237.     kQ3WarningLowMemory,
  238.     kQ3WarningPossibleMemoryLeak,
  239.     /* View Warnings */
  240.     kQ3WarningViewTraversalInProgress,
  241.     kQ3WarningNonInvertibleMatrix,
  242.     /* Quaternion Warning */
  243.     kQ3WarningQuaternionEntriesAreZero,
  244.     /* Renderer Warning */
  245.     kQ3WarningFunctionalityNotSupported,
  246.     /* DrawContext Warning */
  247.     kQ3WarningInvalidPaneDimensions,
  248.     /* Pick Warning */
  249.     kQ3WarningPickParamOutside,
  250.     /* Scale Warnings */
  251.     kQ3WarningScaleEntriesAllZero,
  252.     kQ3WarningScaleContainsNegativeEntries,
  253.     /* Generic Warnings */
  254.     kQ3WarningParameterOutOfRange,
  255.     /* Extension Warnings */
  256.     kQ3WarningExtensionNotLoading,
  257.     /* Object Warnings */
  258.     kQ3WarningTypeAlreadyRegistered,
  259.     kQ3WarningTypeSameVersionAlreadyRegistered,
  260.     kQ3WarningTypeNewerVersionAlreadyRegistered,
  261.     /* Invalid Group Object */
  262.     kQ3WarningInvalidObjectInGroupMetafile
  263. } TQ3Warning;
  264.  
  265.  
  266. typedef enum TQ3Notice {
  267.     kQ3NoticeNone = 0,
  268.     kQ3NoticeDataAlreadyEmpty = -28100,
  269.     kQ3NoticeMethodNotSupported,
  270.     kQ3NoticeObjectAlreadySet,
  271.     kQ3NoticeParameterOutOfRange,
  272.     kQ3NoticeFileAliasWasChanged,
  273.     kQ3NoticeMeshVertexHasNoComponent,
  274.     kQ3NoticeMeshInvalidVertexFacePair,
  275.     kQ3NoticeMeshEdgeVertexDoNotCorrespond,
  276.     kQ3NoticeMeshEdgeIsNotBoundary,
  277.     kQ3NoticeDrawContextNotSetUsingInternalDefaults,
  278.     kQ3NoticeInvalidAttenuationTypeUsingInternalDefaults,
  279.     kQ3NoticeBrightnessGreaterThanOne,
  280.     kQ3NoticeScaleContainsZeroEntries,
  281.     kQ3NoticeSystemAlreadyInitialized,
  282.     kQ3NoticeViewSyncCalledAgain,
  283.     kQ3NoticeFileCancelled
  284. } TQ3Notice;
  285.  
  286. typedef void (QD3D_CALLBACK *TQ3ErrorMethod)(
  287.     TQ3Error    firstError,
  288.     TQ3Error    lastError,
  289.     long        reference);
  290.     
  291. typedef void (QD3D_CALLBACK *TQ3WarningMethod)(
  292.     TQ3Warning    firstWarning,
  293.     TQ3Warning    lastWarning,
  294.     long        reference);
  295.  
  296. typedef void (QD3D_CALLBACK *TQ3NoticeMethod)(
  297.     TQ3Notice    firstNotice,
  298.     TQ3Notice    lastNotice,
  299.     long        reference);
  300.  
  301.  
  302. /******************************************************************************
  303.  **                                                                             **
  304.  **                                Error Routines                                 **
  305.  **                                                                             **
  306.  *****************************************************************************/
  307.  
  308. QD3D_EXPORT TQ3Status QD3D_CALL Q3Error_Register(
  309.     TQ3ErrorMethod        errorPost,
  310.     long                reference);
  311.  
  312. QD3D_EXPORT TQ3Status QD3D_CALL Q3Warning_Register(
  313.     TQ3WarningMethod    warningPost,
  314.     long                reference);
  315.  
  316. QD3D_EXPORT TQ3Status QD3D_CALL Q3Notice_Register(
  317.     TQ3NoticeMethod        noticePost,
  318.     long                reference);
  319.  
  320. /*
  321.  *  Getting error codes -
  322.  *    Clears error type on next entry into system (except all of these 
  323.  *  error calls), and returns the last error, and optionally the 
  324.  *    first error. The parameter to these "_Get" calls may be NULL.
  325.  */
  326. QD3D_EXPORT TQ3Error QD3D_CALL Q3Error_Get(
  327.     TQ3Error            *firstError);
  328.  
  329. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Error_IsFatalError(
  330.     TQ3Error            error);
  331.  
  332. QD3D_EXPORT TQ3Warning QD3D_CALL Q3Warning_Get(
  333.     TQ3Warning            *firstWarning);
  334.  
  335. QD3D_EXPORT TQ3Notice QD3D_CALL Q3Notice_Get(
  336.     TQ3Notice            *firstNotice);
  337.  
  338. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  339.  
  340. QD3D_EXPORT OSErr QD3D_CALL Q3MacintoshError_Get(
  341.     OSErr                *firstMacErr);
  342.  
  343. #endif  /*  OS_MACINTOSH  */
  344. #ifdef __cplusplus
  345. }
  346. #endif  /*  __cplusplus  */
  347.  
  348. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  349.  
  350. #if defined(__xlc__) || defined(__XLC121__)
  351.     #pragma options enum=reset
  352.     #pragma options align=reset
  353. #elif defined(__MWERKS__)
  354.     #pragma enumsalwaysint reset
  355.     #pragma options align=reset
  356. #elif defined(__MRC__) || defined(__SC__)
  357.     #if PRAGMA_ENUM_RESET_QD3DERRORS
  358.         #pragma options(pack_enums)
  359.         #undef PRAGMA_ENUM_RESET_QD3DERRORS
  360.     #endif
  361.     #pragma options align=reset
  362. #endif
  363.  
  364. #endif  /* OS_MACINTOSH */
  365.  
  366. #endif    /*  QD3DError_h  */
  367.